<!DOCTYPE html>
<html>
    <head>
    	<meta charset="utf-8">
    	<base href="${request.scheme}://${request.serverName}:${request.serverPort}${request.contextPath}/" />
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="renderer" content="webkit" />
        <meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1">
		<meta content=always name=referrer>
		
		<link rel="stylesheet" type="text/css" href="assets/css/images/css.css">
		<link href="assets/htwj/logo.ico" rel="shortcut icon">
		<title>
		实验管理系统
		</title>
    </head>
    <body style="background-color:#d5f2fa;">
    <div class="bg01"></div>
 <div id="login_wrap" class="login_wrap">
        
		<div class="login_content" >
			 <h2 class="login_content_h2">实验管理系统</h2>
			<form id="submitForm" >
				<!-- <div id="login_tip">
					<span id="form-message" class="sty_txt2"></span>
				</div> -->
				<div class="longin_input over">
					 <input type="text"  id="userName" name="userName" class="login_input01 login_input011" placeholder="用户名">
					<input type="password"  id="password"  name="password" class="login_input01 login_input012" placeholder="密码">
					<span style="color: red" id="tips"></span>
				<br/>
					<button type="button" class="yh"  id="btlogin"  >登&nbsp;录</button>
				<!-- 	<input type="reset" class="login_btn" id="login_ret" value="重 置"> -->
				</div>
			</form>
		</div>
</div>
    </body>
<script type="text/javascript" src="assets/js/jquery1_12.min.js"></script>
<script src="assets/js/axios.min.js" type="text/javascript"></script>
<script>
        /*
        检查浏览器是否支持
        */
        var isIE = !!window.ActiveXObject;
        var isIE6 = isIE && !window.XMLHttpRequest;
        /* if (isIE6) {
            window.location.href = "../Error/Browser";
        } */
        //回车键
        document.onkeydown = function (e) {
            if (!e) e = window.event; //火狐中是 window.event
            if ((e.keyCode || e.which) == 13) {
                var btlogin = document.getElementById("btlogin");
                btlogin.focus();
                btlogin.click();
            }
        }
        $(function () {
            $("#btlogin").click(function () {
                var userName = $("#userName").val();
                var password = $("#password").val();
                if (userName == "") {
                    $("#userName").focus();
                    $("#tips").text("登录账户不能为空!");
                    //formMessage('登录账户不能为空', 'warning');
                    return false;
                } else if (password == "") {
                    $("#password").focus();
                    $("#tips").text("登录密码不能为空!");
                   // formMessage('登录密码不能为空', 'warning');
                    return false;
                } else {
                   // formMessage('正在登录...', 'succeed');
                    var postData = {
                    		  "account": $("#userName").val(),
                    		  "password": $("#password").val()
                    		}
                    axios.post("ac/login", postData).then(function(res){
                        if(res.data.code==0){
	                    	$("#tips").text("登录成功！");
                        	/* sessionStorage.setItem("user", JSON.stringify(data.content)); */
                        	window.location.href = "${request.contextPath}/content/index.html#content/console.html";
                        }else if(res.data.code==2){
                        	$("#tips").text("密码验证成功，但登录权限已受到限制！");
                        	return false;
                        }else {
                        	$("#tips").text("登录名或密码错误,请重新输入!");
                        	//formMessage('登录名或密码错误,请重新输入', 'error');
                        }
                    });
                }
                return false;
            })
        })
	    //提示信息
	    function formMessage(msg, type) {
	        $('.form-message').html('');
	        $('.form-message').append('<div class="form-' + type + '-text">' + msg + '</div>');
	    }
    </script>
</html>